import { getTable } from './service';

export default {
  namespace: 'orderManage',
  state: {
    list: [],
  },

  effects: {
    *fetchTable({ payload }: any, { call, put }: any) {
      const response = yield call(getTable, payload);
      yield put({
        type: 'queryTable',
        payload: response,
      });
    },
  },

  reducers: {
    queryTable(state: any, { payload }: any) {
      return {
        ...state,
        list: payload,
      };
    },
  },
};
